<?php
/**
 * 生产者-》队列-》消费者
 */
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../Mqtt.php';

$mqtt = new Mqtt;
$mqtt->createChannel();
$mqtt->createQueue('one2one');

$i=1;
while( true ) {

    $msg = "hello,mqtt_{$i}";
    $mqtt->publishMsg($msg);
    echo $msg . PHP_EOL;
    $i++;

    sleep(1);
}

$mqtt->close();
echo "done\n";